package com.lcy.app.api.domain;

import java.io.Serializable;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

public class RespEntity<T> implements Serializable {

    /**
     * 响应码
     * {@link RespCode}
     */
    private int code;

    /**
     * 消息
     */
    private String message;

    /**
     * 消息体
     */
    private T data;

    public RespEntity(final RespCode respCode, final T data) {
        this.code = respCode.getCode();
        this.message = respCode.getMessage();
        this.data = data;
    }

    public RespEntity(final RespCode respCode) {
        this.code = respCode.getCode();
        this.message = respCode.getMessage();
    }

    public RespEntity(final int code, final String msg) {
        this.code = code;
        this.message = msg;
    }

    public RespEntity(){}

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}

